<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Sistema de Cadastro</title>
        <link rel="stylesheet" href="menu.css" type="text/css" />
    </h:head>
    <h:body>
        <f:view contentType="text/html">
            <ui:composition template="template.xhtml">
                <ui:define name="titulo">Sistema de Cadastro</ui:define>

                <ui:define name="body">


                    <br/><br/><br/><br/>
  <p:growl id="growl" showDetail="true" life="3000" /> 
                    <h:form prependId="false" id="faculdadelist">

                        <p:dataTable  var="item" value="#{faculdadeController.todos}" style="width:870px; height: 380px" paginator="true" rows="6" >
                            <f:facet name="header">
                                Faculdades
                                <p:commandButton update="display" oncomplete="faculdadeAd.show()"
                                                 actionListener="#{faculdadeController.clear}"               title="Adicionar"          image="ui-icon ui-icon-plusthick"

                                                 />
                            </f:facet>

                            <p:column  filterBy="#{item.nome}">
                                <f:facet name="header">
                                    <h:outputText value="Nome" />
                                </f:facet>
                                <h:outputText value="#{item.nome}" />
                            </p:column>


                            <p:column style="width:32px">
                                <p:commandButton update="display" oncomplete="faculdadeDialog.show()"
                                                 title="Editar"          image="ui-icon ui-icon-pencil"

                                                 >
                                    <f:setPropertyActionListener value="#{item}"
                                                                 target="#{faculdadeController.bean}" />
                                </p:commandButton>
                            </p:column>
                            <p:column style="width:32px">
                                <p:commandButton update="display3" oncomplete="faculdadeEx.show()"
                                                 title="Excluir"          image="ui-icon ui-icon-trash"

                                                 >
                                    <f:setPropertyActionListener value="#{item}"
                                                                 target="#{faculdadeController.bean}" />
                                </p:commandButton>
                            </p:column>

                        </p:dataTable>
                    </h:form>
     <h:form prependId="false">
                        <p:dialog header="Detalhe Faculdade" widgetVar="faculdadeDialog" resizable="false"
                                  height="170" width="350" showEffect="explode" hideEffect="explode"
                              
                                  >

                            <h:panelGrid id="display" columns="2" cellpadding="4">

                                <h:outputText value="Nome" />
                                <p:inputText value="#{faculdadeController.bean.nome}" id="detalFaculNome"/>
                                
                                <p:commandButton actionListener="#{faculdadeController.update}"  oncomplete="faculdadeDialog.hide()"
                                                 image="ui-icon ui-icon-disk" update="growl,faculdadelist"
                                               
                                                 >
                             
                                </p:commandButton>

                            </h:panelGrid>
                        </p:dialog>
     </h:form>
  <h:form prependId="false">
                        <p:dialog header="Excluir Faculdade" widgetVar="faculdadeEx" resizable="false"
                                  height="170" width="350" showEffect="explode" hideEffect="explode" >

                            <h:panelGrid id="display3" columns="2" cellpadding="4">

                                <h:outputText value="Deseja Excluir ?" />
                                <h:outputText value="#{faculdadeController.bean.nome}" />
                                <p:commandButton actionListener="#{faculdadeController.excluir}" oncomplete="faculdadeEx.hide()"
                                                 value="ok" image="ui-icon ui-icon-trash" update="faculdadelist"             />

                            </h:panelGrid>
                        </p:dialog>
  </h:form>

<h:form prependId="false">
                
                        <p:dialog header="Adicionar Faculdade" widgetVar="faculdadeAd" resizable="false"
                                  height="170" width="350" showEffect="explode" hideEffect="explode" >

                            <h:panelGrid id="display2" columns="2" cellpadding="4">

                                <h:outputText value="Nome" />
                                <h:inputText value="#{faculdadeController.bean.nome}" />
                                <p:commandButton actionListener="#{faculdadeController.salvar}" oncomplete="faculdadeAd.hide()"
                                                 image="ui-icon ui-icon-disk" update="growl,faculdadelist"            />

                            </h:panelGrid>
                        </p:dialog>


                    </h:form>

 
                </ui:define></ui:composition>
        </f:view>
    </h:body>
</html>

